﻿/*
=======================================================
    SuperUser【超级用户】
=======================================================
*/

namespace Services
{
    public interface ISuperUserRepository : IRepository<SuperUser>
    {
        SuperUser GetUserByLogin(string loginName, string password);
    }


    public class SuperUserRepository : BaseRepository<SuperUser>, ISuperUserRepository
    {
        public SuperUserRepository(ISqlSugarClient dB, ICurrentUser currentUser, IQuery<SuperUser> query)
            : base(dB, currentUser, query)
        {
        }

        #region GetUserByLogin
        public SuperUser GetUserByLogin(string loginName, string password)
        {
            password = Gx.DesEncrypt(password);
            return _query.GetQueryable().Where(x => x.LoginName == loginName && x.LoginPassword == password).First();
        }
        #endregion
    }
}
